package org.hd.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/***
 * 解决跨域问题
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedOrigins("http://127.0.0.1:8848","http://localhost:3000","http://192.168.3.58:3000","http://139.224.217.222:8080")
                    .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
                    .maxAge(3600)
                    .allowCredentials(true)
                    .allowedHeaders("satoken");
        }



}
